
# # -*- coding: utf-8 -*-
from functools import wraps
def min0(origin_func):
    @wraps(origin_func)   #把原函数的元信息拷贝到装饰器函数中，使得装饰器函数和原函数有一样的元信息
    def wrapper(self,*args,**kwargs):
        if len(self.zhan):
            print(self.zhan)
            return origin_func(self,*args,**kwargs)
        else:
            return False
    return wrapper
class MinStack:

    def __init__(self):
        # do intialization if necessary
        self.zhan=[]

    """
    @param: number: An integer
    @return: nothing
    """


    def push(self, number):
        # write your code here
        self.zhan.insert(0,number)

    """
    @return: An integer
    """

    def pop(self):
        # write your code here
        no0 = self.zhan[0]
        del self.zhan[0]
        return no0

    """
    @return: An integer
    """

    @min0
    def min(self):
        # write your code here

        print('min:self.zhan', self.zhan)
        return min(self.zhan)
a = MinStack()
a.push(2)
a.push(3)
print(a.min())

# import re
# t = b'\xb1\x0e\x00\x00\xb1\x0e\x00\x00\xb2\x02\x00\x00type@=online_noble_list/num@=312/rid@=288016/nl@=uid@AA=14207472@ASnn@AA=\xe5\x87\x89\xe5\xae\xab\xe9\x98\xb5\xe9\x93\x81\xe5\x90\xb4@ASicon@AA=avatar_v3@AAS201807@AAS2c9ee3674ba446f8b004d823e5b257cb@ASne@AA=4@ASlv@AA=64@ASrk@AA=44@ASpg@AA=1@ASrg@AA=1@ASsahf@AA=0@AS@Suid@AA=90693352@ASnn@AA=DY\xe5\xa8\xb1\xe4\xb9\x90\xe5\x85\xab\xe5\x8d\xa6@ASicon@AA=avanew@AASface@AAS201805@AASbb439f1d6edd8e02529e3d2d1ed14a48@ASne@AA=4@ASlv@AA=46@ASrk@AA=44@ASpg@AA=1@ASrg@AA=1@ASsahf@AA=0@AS@Suid@AA=41476959@ASnn@AA=\xe4\xb8\xad\xe6\x86\xac\xe7\xa7\x81\xe4\xba\xba\xe8\xae\xa2\xe5\x88\xb6\xe7\x8e\xb0\xe5\x9c\xba\xe9\x9b\x95\xe5\x88\xbb@ASicon@AA=avatar@AASface@AAS201603@AAS5909c9cafae2f7936dc879b8a8a69ff0@ASne@AA=4@ASlv@AA=39@ASrk@AA=44@ASpg@AA=1@ASrg@AA=1@ASsahf@AA=0@AS@Suid@AA=207403633@ASnn@AA=\xe4\xb8\xad\xe5\x9b\xbd\xe8\x93\x9d\xe4\xb8\xb6\xe5\x9d\x8f\xe5\xb0\x91\xe6\x8b\x9b\xe6\x98\x9f\xe6\x8e\xa2@ASicon@AA=avatar@AASdefault@AAS12@ASne@AA=4@ASlv@AA=22@ASrk@AA=44@ASpg@AA=1@ASrg@AA=1@ASsahf@AA=0@AS@Suid@AA=96622922@ASnn@AA=\xe5\xb0\x8f\xe9\x92\xb1\xe9\x92\xb1\xe9\x92\xb1\xe9\x92\xb1\xe9\x92\xb1\xe9\x92\xb1\xe9\x92\xb1\xe9\x92\xb1@ASicon@AA=avanew@AASface@AAS201802@AAS11@AAS03@AAS12aa84992dde8f9f8d33728bfef04588@ASne@AA=3@ASlv@AA=59@ASrk@AA=33@ASpg@AA=1@ASrg@AA=1@ASsahf@AA=0@AS@Suid@AA=41223646@ASnn@AA=\xe9\x80\x86\xe6\x97\xb6\xe9\x92\x9f\xe8\x80\x8c\xe7\xbb\x95\xe7\x9a\x84\xe4\xba\xba\xe7\x94\x9f@ASicon@AA='
#
# com = re.compile(b'nl@=(.*)')
# # ret = com.findall(t)
# ret = re.search(com,t)
# # print(ret[0].decode('utf-8'))
# print(ret.group(1).decode())

# #使用装饰器改变函数行为
# from string import punctuation
# def pipeline_wrapper(func):#func表示被装饰函数
#     def to_lower(x):
#         print(x)
#         return x.lower()
#     def remove_punc(x):
#         for p in punctuation:
#             x=x.replace(p,' ')
#         return x
#     def wrapper(*args,**kwargs):
#         x=to_lower(*args,**kwargs)#当参数不确定时，可用*args和*kwargs\
#                                 #*args可当做可容纳多个变量的list\
#                                 #*kwargs可当做可容纳多个键和值的字典
#         print(type(x))
#         x=remove_punc(x)
#         return func(x)
#     return wrapper#返回wrapper函数
#
# @pipeline_wrapper #装饰器函数，名称为装饰器的名称
# def tokenize_whitespace(inText):
#     return inText.split()
#
# s="string.With.Punctuation?"
# print(tokenize_whitespace(s))#先运行装饰器，再运行被装饰的函数